package com.example.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
@Slf4j
public class TimeAspect {

    @Around(value = "execution(* com.example.mapper.EmployeeMapper.queryPage())")
    public Object recodeTime(ProceedingJoinPoint joinPoint) throws Throwable {
        long l = System.nanoTime();
        Object proceed = joinPoint.proceed();
        long end = System.nanoTime();
        log.info("总共耗时：{}",end-l);
        System.out.println("-----------------------------");
        return proceed;

    }
}
